d2fd19a54153dc2904a3b43981b9cc948b1e702b,jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java,MethodHandles,countedLoop,#MethodHandle#MethodHandle#MethodHandle#MethodHandle#,4478
Before Change
*/
public static MethodHandle countedLoop(MethodHandle start, MethodHandle end, MethodHandle init, MethodHandle body) {
MethodHandle returnVar = dropArguments(init == null || init.type().returnType() == void.class ?
zero(void.class) : identity(init.type().returnType()), 0, int.class, int.class);
MethodHandle[] indexVar = {start, MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_countedLoopStep)};
MethodHandle[] loopLimit = {end, null, MethodHandleImpl.getConstantHandle(MethodHandleImpl.MH_countedLoopPred), returnVar};
MethodHandle[] bodyClause = {init,
After Change
resultType = body == null ? void.class : body.type().returnType();
actualInit = empty(methodType(resultType));
} else {
resultType = init.type().returnType();
actualInit = init;
}
MethodHandle defaultResultHandle = resultType == void.class ? zero(void.class) : identity(resultType);
MethodHandle actualBody = body == null ? dropArguments(defaultResultHandle, 0, int.class) : body;
MethodHandle returnVar = dropArguments(defaultResultHandle, 0, int.class, int.class);
MethodHandle actualEnd = end == null ? constant(int.class, 0) : end;